package com.gzx.spring.drools.controller;

import com.gzx.risk.core.feign.request.ContractInfoReq;
import com.gzx.spring.drools.provider.MiniApiFeignService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@Slf4j
@RestController
@RequestMapping("/api/order/ext")
public class MiniApiController implements MiniApiFeignService {

    @Override
    @PostMapping("/queryContractAndUserExt")
    public String queryContractAndUserExt(ContractInfoReq requestStr){
        String name = "/debug/miniResp";
        String json = "";
        try {
            json = IOUtils.toString(MiniApiController.class.getResourceAsStream(name + ".json"), "UTF-8");
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        return json;
    }
}
